package com.polaris.live.adapter.user_space

import android.view.View
import com.bumptech.glide.Glide
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.databinding.AdapterUserSpaceGiftBinding
import com.polaris.live.resp.back_resp.UserOtherGiftVo
import com.polaris.live.utils.image.ImageUtils

/**
 * UserSpaceGiftAdapter
 *
 * @author Created by 半仙 on 2023/9/22/022 17:47
 */
class UserSpaceGiftAdapter :
    BaseBindingAdapter<AdapterUserSpaceGiftBinding, UserOtherGiftVo>() {

    override fun convert(holder: VBViewHolder<AdapterUserSpaceGiftBinding>, item: UserOtherGiftVo) {
        holder.vb.apply {
            if (item.url == null) {
                itemNum.visibility = View.INVISIBLE
            } else {
                itemNum.visibility = View.VISIBLE
                Glide.with(itemImg.context).load(ImageUtils.imgPath(item.url)).into(itemImg)
                itemNum.text = "×${item.number}"
            }
        }
    }

}